home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tegl6b.zip / INTROPAK.EXE / lha / TWDDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1991-06-26  |  4KB  |  161 lines

  1. {---------------------------------------------------------}
  2. { TEGL WINDOWS TOOLKIT II, Release 2.0                    }
  3. { Copyright 1989, 1991 TEGL System Corporation.           }
  4. { All rights reserved.                                    }
  5. {---------------------------------------------------------}
  6.  
  7. {$M 4384,64000,640000}
  8. {$I switches.inc}
  9. {$N+}
  10. {$E+}
  11.  
  12. USES
  13.  
  14.   teglfont,
  15.   FastGrph,
  16.   {$IFDEF NoGr}
  17.   TGraph,
  18.   {$ELSE}
  19.   drvevga,
  20.   Graph,
  21.   {$ENDIF}
  22.   virtmem,
  23.   teglintr,
  24.   teglunit,
  25.   teglmain,
  26.   twcommon,
  27.   twkernel,
  28.   twwindow,
  29.   twcontrl,
  30.   twdialog,
  31.   twdialud,
  32. {$IFOPT N+}
  33.   twdialfp,
  34. {$ENDIF}
  35.   moreicon;
  36.  
  37. {$F+}
  38.  
  39.  
  40. Function OKEvent(ifs : ImageStkPtr; ms : MsClickPtr): word;
  41.   VAR wf : WinFramePtr;
  42.   BEGIN
  43.     wf := findWinFrame(ifs);
  44.     {dropstackimage(ifs);}
  45.   END;
  46.  
  47. VAR wf : WinFramePtr;
  48.  
  49. TYPE
  50.   samdatdef = record
  51.     cbitem : boolean;
  52.     ilitem : string[30];
  53.     ilitem2: string[30];
  54.     float  : real;
  55.     intitem: integer;
  56.     rbitem : integer;
  57.   end;
  58. CONST
  59.   samdat : samdatdef =
  60.     (cbitem : false;
  61.      ilitem : 'Some text, jj';
  62.      ilitem2 : 'Additional String';
  63.      float : 123.45;
  64.      intitem : 2345;
  65.      rbitem : 3);
  66.  
  67. {-- the cancel event would do the appropriate processind then it }
  68. {-- must call twdclose to dispose of the dialog and all its }
  69. {-- associate memory allocation. twdclose in turn calls twclose }
  70. {-- which ulitmately disposes of the the window. }
  71.  
  72. function cancelevent(ifs: ImageStkPtr; ms: MsClickPtr): Word;
  73.   VAR wf: WinFramePtr;
  74.   begin
  75.     wf := findWinFrame(ifs);
  76.     cancelevent := twdClose(ifs,ms);
  77.   end;
  78.  
  79. function showevent(ifs: ImageStkPtr; ms: MsClickPtr): Word;
  80.   VAR wf: WinFramePtr;
  81.   begin
  82.     twInit(wf,150,150,400,250);
  83.     twSetHeader(wf,'Show variable contents.');
  84.     twDrawWindowFrame(wf);
  85.     twCrtAssign(wf);
  86.     twSelect(wf);
  87.     twSetResize(wf,false);
  88.     writeln(samdat.cbitem);
  89.     writeln(samdat.ilitem);
  90.     writeln(samdat.float:12:2);
  91.   end;
  92.  
  93. Procedure InstallDialog1;
  94.   BEGIN
  95.   twdInit(wf,100,100,450,400);
  96.   twsetCloseEvent(wf,cancelevent);  {-- the spacebar menu }
  97.  
  98.   twSetHeader(wf,'Dialogue Window');
  99.  
  100.   twdAddLabel(wf,20,5,'This is a label at (20,5)');
  101.  
  102.   twdAddCheckBox(wf, 20, 30, 'A Check Box',samdat.cbitem);
  103.   twdAddRadioButton(wf, 20, 50, 'A Radio Button (1)',samdat.rbitem);
  104.   twdAddRadioButton(wf, 20, 70, 'A Radio Button (2)',samdat.rbitem);
  105.   twdAddRadioButton(wf, 20, 90, 'A Radio Button (3)',samdat.rbitem);
  106.  
  107.   twdAddInputLine(wf,20,110,'An input line',samdat.ilitem,20);
  108.   twdAddInputLine(wf,20,130,'Another input line',samdat.ilitem2,20);
  109.  
  110.   twdAddReal(wf,20,150,'A real number',samdat.float,12,2);
  111.   twdAddInteger(wf,20,170,'An integer',samdat.intitem,4);
  112.  
  113.   twdAddButton(wf,60,200,'OK',OKEvent);
  114.   twdAddbutton(wf,200,200,'CANCEL',CancelEvent);
  115.   twdAddButton(wf,60,240,'SHOW',showEvent);
  116.  
  117.   {twSetRedraw(wf,twdRedraw);}
  118.   twDrawWindowFrame(wf);
  119.   END;
  120.  
  121. {$IFOPT N+}
  122.  
  123.   CONST single1 : single = 5.6789;
  124.         double1 : double = 10.876;
  125. Procedure InstallDialog2;
  126.   VAR wf: WinFramePtr;
  127.   BEGIN
  128.     twdInit(wf,200,150,550,400);
  129.     twsetCloseEvent(wf,CancelEvent);
  130.     twsetheader(wf,'Floating point types');
  131.     twdAddSingle(wf,20,10,'Single precision number ',single1,12,6);
  132.     twdAddDouble(wf,20,40,'Double precision number ',double1,12,6);
  133.     twdAddButton(wf,20,150,'OK',OKEvent);
  134.     twdAddbutton(wf,80,150,'CANCEL',CancelEvent);
  135.     twDrawWindowFrame(wf);
  136.   END;
  137.  
  138. {$ENDIF}
  139.  
  140. BEGIN
  141.  
  142.   maxwindowsize := maxavail DIV 3;
  143.   twEasyStart;
  144.   twCRtOn;
  145.   setautorotate(true);
  146.   setkeyboardmouse(false);
  147.   SetTeglFont(@f8x12bol);
  148. {  twcInstallMonitor;}
  149. {  twcInstallSizes; }
  150.   {---------}
  151.   twSetDialogFont(@font14);
  152.  
  153.   InstallDialog1;
  154. {$IFOPT N+}
  155.   InstallDialog2;
  156. {$ENDIF}
  157.   SetAutoRotate(TRUE);
  158.   TeglSuperVisor;
  159. END.
  160.  
  161.